package ahblue.cn.tanzi.ui.dialog;

import android.graphics.Color;
import android.support.v4.app.FragmentActivity;

import com.rhino.dialog.BottomSelectDialogFragment;
import com.rhino.dialog.impl.DefaultDialogListener;

import java.util.ArrayList;
import java.util.List;

/**
 * @author rhino
 * @since Create on 2019/3/19.
 **/
public class DialogFactory {

    /**
     * 显示从底部弹出选择对话框
     *
     * @param fragmentActivity fragmentActivity
     * @param title            标题
     * @param itemList         选择数据
     * @param listener         监听
     */
    public static BottomSelectDialogFragment showBottomSheetSelectDialog(FragmentActivity fragmentActivity, String title,
                                                                         List<BottomSelectDialogFragment.Item> itemList,
                                                                         BottomSelectDialogFragment.IOnItemClickListener listener) {
        BottomSelectDialogFragment dialogFragment = new BottomSelectDialogFragment();
        dialogFragment.setTitleText(title);
        dialogFragment.setCancelable(true);
        dialogFragment.setIOnDialogListener(new DefaultDialogListener());
        dialogFragment.setItems(itemList);
        dialogFragment.setOnItemClickListener(listener);
        dialogFragment.setItemCancelText("取消");
        dialogFragment.show(fragmentActivity);
        return dialogFragment;
    }

    /**
     * 显示选择照片对话框
     *
     * @param fragmentActivity fragmentActivity
     * @param listener         监听
     */
    public static BottomSelectDialogFragment showCircleFabuDialog(FragmentActivity fragmentActivity,
                                                                 BottomSelectDialogFragment.IOnItemClickListener listener) {
        List<BottomSelectDialogFragment.Item> list = new ArrayList<>();
        list.add(BottomSelectDialogFragment.Item.build("文字", Color.BLACK));
        list.add(BottomSelectDialogFragment.Item.build("图片", Color.BLACK));
        list.add(BottomSelectDialogFragment.Item.build("视频", Color.BLACK));
        return showBottomSheetSelectDialog(fragmentActivity, "", list, listener);
    }

}
